package cn.shanks.springbootshirojwt.publisher;

import lombok.SneakyThrows;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @author Shanks
 * @version 1.0
 * @program cn.shanks.springbootshirojwt.publisher
 * @description
 * @date 2020/11/17 11:59
 */
@Component
@Async
public class UserLoginListener implements ApplicationListener<UserLoginEvent> {

    @SneakyThrows
    @Override
    public void onApplicationEvent(UserLoginEvent event) {
        System.out.println("有一个用户登录了");
        TimeUnit.SECONDS.sleep(10);
        System.out.println("延时结束");
    }
}
